package com.android.videotest;

import android.app.Application;
import android.content.Context;

import androidx.multidex.MultiDex;

import com.android.videotest.music.MusicLibrary;
import com.danikula.videocache.HttpProxyCacheServer;

/**
 * 项目名称：VideoTest
 * 类 名 称：App
 * 类 描 述：全局Application
 * 创建时间：2019-11-15 10:37
 * 创 建 人：sansecy
 */
public class App extends Application {
    private static App app;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(base);
    }

    public static App getApp() {
        return app;
    }

    private HttpProxyCacheServer proxy;

    public static HttpProxyCacheServer getProxy() {
        return app.proxy == null ? (app.proxy = app.newProxy()) : app.proxy;
    }

    private HttpProxyCacheServer newProxy() {
        return new HttpProxyCacheServer(this);
    }
}
